package com.hui.xiao.xiaohui.view;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.MultiAutoCompleteTextView;

import com.hui.xiao.xiaohui.R;

/**
 * Created by Administrator on 2016/5/19.
 */
public class AutoCompleteText extends Activity {
    AutoCompleteTextView view;
    MultiAutoCompleteTextView multiAutoCompleteTextView;
    String[] books = new String[]{
            "红楼梦", "红酒", "红色传奇", "水浒传"
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.auto_complete_text_view);
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, books);
        view = (AutoCompleteTextView) findViewById(R.id.auto);
        view.setAdapter(adapter);
        multiAutoCompleteTextView = (MultiAutoCompleteTextView) findViewById(R.id.multi_auto);
        multiAutoCompleteTextView.setAdapter(adapter);
        multiAutoCompleteTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer()
        );
    }
}
